home *** CD-ROM | disk | FTP | other *** search
- The Independent JPEG Group's JPEG software
- ==========================================
-
- README for release 3 of 17-Mar-92
- ==================================
-
- This distribution contains the third official release of the Independent JPEG
- Group's free JPEG software. You are welcome to redistribute this software and
- to use it for any purpose, subject to the conditions under LEGAL ISSUES, below.
-
- For usage instructions, see section USAGE.
-
- This software is still undergoing revision. Updated versions may be obtained
- by FTP or UUCP to UUNET and other archive sites; see ARCHIVE LOCATIONS below
- for details.
-
- If you intend to become a serious user of this software, please contact
- jpeg-info@uunet.uu.net to be added to our electronic mailing list. Then
- you'll be notified of updates and have a chance to participate in discussions,
- etc.
-
- This software is the work of Tom Lane, Philip Gladstone, Luis Ortiz,
- Lee Crocker, Ge' Weijers, and other members of the Independent JPEG Group.
-
-
- DISCLAIMER
- ==========
-
- THIS SOFTWARE IS NOT COMPLETE NOR FULLY DEBUGGED. It is not guaranteed to be
- useful for anything, nor to be compatible with subsequent releases, nor to be
- an accurate implementation of the JPEG standard. (See LEGAL ISSUES for even
- more disclaimers.)
-
- Please report any problems with this software to jpeg-info@uunet.uu.net.
-
-
- WHAT'S HERE
- ===========
-
- This distribution contains compiled C software to implement JPEG image
- compression and decompression. JPEG (pronounced "jay-peg") is a standardized
- compression method for full-color and gray-scale images. JPEG is intended for
- "real-world" scenes; cartoons and other non-realistic images are not its strong
- suit. JPEG is lossy, meaning that the output image is not necessarily
- identical to the input image. Hence you should not use JPEG if you have to
- have identical output bits. However, on typical images of real-world scenes,
- very good compression levels can be obtained with no visible change, and
- amazingly high compression levels can be obtained if you can tolerate a
- low-quality image. For more details, see the references, or just experiment
- with various compression settings.
-
- The software implements JPEG baseline and extended-sequential compression
- processes. Provision is made for supporting all variants of these processes,
- although some uncommon parameter settings aren't implemented yet. For legal
- reasons, we are not distributing code for the arithmetic-coding process; see
- LEGAL ISSUES. At present we have made no provision for supporting the
- progressive, hierarchical, or lossless processes defined in the standard.
-
- The present software is not far beyond the prototype stage. It does not
- support all possible variants of the JPEG standard, and some functions have
- rather slow and/or crude implementations. However, it is useful already.
-
- The emphasis in designing this software has been on achieving portability and
- flexibility, while also making it fast enough to be useful. We have not yet
- undertaken serious performance measurement or tuning; we intend to do so in
- the future.
-
- In particular, we welcome the use of this software as a component of commercial
- products; no royalty is required.
-
-
- ARCHIVE LOCATIONS
- =================
-
- The "official" archive site for this software (including the source) is
- ftp.uu.net (Internet address 137.39.1.9 or 192.48.96.9). The most recent
- released version can always be found there in directory graphics/jpeg. This
- particular version will be archived as jpegsrc.v3.tar.Z. If you are on the
- Internet, you can retrieve files from UUNET by anonymous FTP. If you don't
- have FTP access, UUNET's archives are also available via UUCP; contact
- postmaster@uunet.uu.net for information on retrieving files that way.
-
- Various other Internet sites maintain copies of the UUNET file, which may or
- may not be up-to-date. In Europe, try nic.funet.fi (128.214.6.100; look in
- directory pub/graphics/programs/jpeg).
-
- You can also obtain this software from CompuServe, in the GRAPHSUPPORT forum
- (GO PICS), library 10; this version will be file jpsrc3.zip.
-
-
- SOFTWARE THAT'S NO HELP AT ALL
- ==============================
-
- Handmade Software's shareware PC program GIF2JPG produces files that are
- totally incompatible with our programs. They use a proprietary format that is
- an amalgam of GIF and JPEG representations. However, you can force GIF2JPG
- to produce compatible files with its -j switch, and their decompression
- program JPG2GIF can read our files (at least ones produced with our default
- option settings).
-
- Unfortunately, many commercial JPEG implementations are also incompatible as
- of this writing, especially programs released before summer 1991. The root of
- the problem is that the ISO JPEG committee failed to specify a concrete file
- format. Some vendors "filled in the blanks" on their own, creating
- proprietary formats that no one else could read. (For example, none of the
- early commercial JPEG implementations for the Macintosh were able to exchange
- compressed files.)
-
- The file format we have adopted is called JFIF (see REFERENCES). This format
- has been agreed to by a number of major commercial JPEG vendors, and we expect
- that it will become the de facto standard. JFIF is a minimal representation;
- work is also going forward to incorporate JPEG compression into the TIFF
- standard, for use in "high end" applications that need to record a lot of
- additional data about an image. We intend to support JPEG-in-TIFF in the
- future. We hope that these two formats will be sufficient and that other,
- incompatible JPEG file formats will not proliferate.
-
- Indeed, part of the reason for developing and releasing this free software is
- to help force rapid convergence to de facto standards for JPEG file formats.
- SUPPORT STANDARD, NON-PROPRIETARY FORMATS: demand JFIF or JPEG-in-TIFF!
-
-
- REFERENCES
- ==========
-
- The best and most readily available introduction to the JPEG compression
- algorithm is Wallace's article in the April '91 CACM:
- Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
- Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44.
- (Adjacent articles in that issue discuss MPEG motion picture compression,
- applications of JPEG, and related topics.) We highly recommend reading that
- article before trying to understand the innards of any JPEG software.
- If you don't have the CACM issue handy, a PostScript file containing a revised
- version of the article is available at ftp.uu.net, graphics/jpeg/wallace.ps.Z.
- The file (actually a preprint for an article to appear in IEEE Trans. Consumer
- Electronics) omits the sample images that appeared in CACM, but it includes
- corrections and some added material. Note: the Wallace article is copyright
- ACM and IEEE, and it may not be used for commercial purposes.
-
- For more detail about the JPEG standard you pretty much have to go to the
- draft standard (which is not nearly as intelligible as Wallace's article).
- The standard is not now available electronically; you must order a paper copy
- through ISO. In the US, copies may be ordered from ANSI Sales at (212)
- 642-4900. The standard is divided into two parts: Part 1 is the actual
- specification, and Part 2 covers compliance testing methods. The current
- "committee draft" version of Part 1 is titled "Digital Compression and Coding
- of Continuous-tone Still Images, Part 1: Requirements and guidelines" and has
- document number ISO/IEC CD 10918-1. (The alternate number SC2 N2215 should
- also be mentioned when ordering.) This draft is expected to be superseded by
- the Draft International Standard version around the end of November 1991.
- Ordering info will be the same as above, but replace "CD" with "DIS" in the
- document number (alternate number not yet known). The committee draft of
- Part 2 is expected to be available around the end of December 1991. It will
- be titled "Digital Compression and Coding of Continuous-tone Still Images,
- Part 2: Compliance testing" and will have document number ISO/IEC CD 10918-2
- (alternate number not yet known).
-
- The JPEG standard does not specify all details of an interchangeable file
- format. For the omitted details we follow the "JFIF" conventions, revision
- 1.01. A copy of the JFIF spec is available from:
- Literature Department
- C-Cube Microsystems, Inc.
- 399A West Trimble Road
- San Jose, CA 95131
- (408) 944-6300
- The same source can supply copies of the draft JPEG-in-TIFF documents
- (Appendixes O and P to the TIFF spec). PostScript versions of these
- documents can also be obtained by e-mail from the C-Cube mail server,
- netlib@c3.pla.ca.us. Send the message "send jfif_ps from jpeg" to obtain the
- JFIF document; "send app_o_ps from jpeg" and "send app_p_ps from jpeg" will
- produce the TIFF documents. Send the message "help" if you have trouble.
-
-
- LEGAL ISSUES
- ============
-
- The authors make NO WARRANTY or representation, either express or implied,
- with respect to this software, its quality, accuracy, merchantability, or
- fitness for a particular purpose. This software is provided "AS IS", and you,
- its user, assume the entire risk as to its quality and accuracy.
-
- This software is copyright (C) 1991, 1992, Thomas G. Lane.
- All Rights Reserved except as specified below.
-
- Permission is hereby granted to use, copy, modify, and distribute this
- software (or portions thereof) for any purpose, without fee, subject to these
- conditions:
- (1) If any part of the source code for this software is distributed, then this
- README file must be included, with this copyright and no-warranty notice
- unaltered; and any additions, deletions, or changes to the original files
- must be clearly indicated in accompanying documentation.
- (2) If only executable code is distributed, then the accompanying
- documentation must state that "this software is based in part on the work of
- the Independent JPEG Group".
- (3) Permission for use of this software is granted only if the user accepts
- full responsibility for any undesirable consequences; the authors accept
- NO LIABILITY for damages of any kind.
-
- Permission is NOT granted for the use of any author's name or author's company
- name in advertising or publicity relating to this software or products derived
- from it. This software may be referred to only as "the Independent JPEG
- Group's software".
-
- We specifically permit and encourage the use of this software as the basis of
- commercial products, provided that all warranty or liability claims are
- assumed by the product vendor.
-
- It appears that the arithmetic coding option of the JPEG spec is covered by
- patents owned by IBM and AT&T, as well as a pending Japanese patent of
- Mitsubishi. Hence arithmetic coding cannot legally be used without obtaining
- one or more licenses. For this reason, support for arithmetic coding has been
- removed from the free JPEG software. (Since arithmetic coding provides only a
- marginal gain over the unpatented Huffman mode, it is unlikely that very many
- people will choose to use it. If you do obtain the necessary licenses,
- contact jpeg-info@uunet.uu.net for a copy of our arithmetic coding modules.)
- So far as we are aware, there are no patent restrictions on the remaining
- code.
-
-
- We are required to state that
- "The Graphics Interchange Format(c) is the Copyright property of
- CompuServe Incorporated. GIF(sm) is a Service Mark property of
- CompuServe Incorporated."
-
-
- TO DO
- =====
-
- Many of the modules need fleshing out to provide more complete
- implementations, or to provide faster paths for common cases.
- Improving the speed will be the next big work item for the JPEG group.
-
- We'd appreciate it if people would compile and check out the code on as wide a
- variety of systems as possible, and report any portability problems
- encountered (with solutions, if possible). Checks of file compatibility with
- other JPEG implementations would also be of interest. Finally, we would
- appreciate code profiles showing where the most time is spent, especially on
- unusual systems.
-
- Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net.
-
- USAGE instructions for the Independent JPEG Group's JPEG software
- =================================================================
-
- GENERAL USAGE
-
- We provide two programs, cjpeg to compress an image file into JPEG format,
- and djpeg to decompress a JPEG file back into a conventional image format.
-
- On Unix-like systems, you say:
- cjpeg [switches] [imagefile] >jpegfile
- or
- djpeg [switches] [jpegfile] >imagefile
- The programs read the specified input file, or standard input if none is
- named. They always write to standard output (with trace/error messages to
- standard error). These conventions are handy for piping images between
- programs.
-
- On most non-Unix systems, you say:
- cjpeg [switches] imagefile jpegfile
- or
- djpeg [switches] jpegfile imagefile
- i.e., both the input and output files are named on the command line. This
- style is a little more foolproof, and it loses no functionality if you don't
- have pipes. (You can get this style on Unix too, if you prefer, by defining
- TWO_FILE_COMMANDLINE when you compile the programs; see SETUP.)
-
- The currently supported image file formats are: PPM (PBMPLUS color format),
- PGM (PBMPLUS gray-scale format), GIF and Targa. cjpeg recognizes the input
- image format automatically, with the exception of some Targa-format files. You
- have to tell djpeg which format to generate (PPM by default).
-
- The only JPEG file format currently supported is the JFIF format. Support for
- the TIFF/JPEG format will probably be added at some future date.
-
-
- CJPEG DETAILS
-
- The command line switches for cjpeg are:
-
- -Q quality Scale quantization tables to adjust image quality.
- Quality is 0 (worst) to 100 (best); default is 75.
- (See below for more info.)
-
- -o Perform optimization of entropy encoding parameters.
- Without this, default encoding parameters are used.
- -o usually makes the JPEG file a little smaller, but
- cjpeg runs somewhat slower and needs much more memory.
- Image quality and speed of decompression are unaffected
- by -o.
-
- -T Input file is Targa format. Targa files that contain
- an "identification" field will not be automatically
- recognized by cjpeg; for such files you must specify
- -T to force cjpeg to treat the input as Targa format.
-
- -I Generate noninterleaved JPEG file (not yet supported).
-
- -a Use arithmetic coding rather than Huffman coding.
- (Not currently supported for legal reasons.)
-
- -d Enable debug printout. More -d's give more printout.
- Also, version information is printed at startup.
-
- -m memory Set limit for amount of memory to use in processing
- large images. Value is in thousands of bytes, or
- millions of bytes if "M" is attached to the number.
- For example, -m 4m selects 4000000 bytes. If more
- space is needed, temporary files will be used.
-
- The -Q switch lets you trade off compressed file size against quality of the
- reconstructed image: the higher the -Q setting, the larger the JPEG file, and
- the closer the output image will be to the original input. Normally you want
- to use the lowest -Q setting (smallest file) that decompresses into something
- visually indistinguishable from the original image. For this purpose the -Q
- setting should be between 50 and 95; the default of 75 is often about right.
- If you see defects at -Q 75, then go up 5 or 10 counts at a time until you are
- happy with the output image. (The optimal setting will vary from one image to
- another.)
-
- -Q 100 will generate a quantization table of all 1's, eliminating loss in the
- quantization step (but there is still information loss in subsampling, as well
- as roundoff error). This setting is mainly of interest for experimental
- purposes. -Q values above about 95 are NOT recommended for normal use; the
- compressed file size goes up dramatically for hardly any gain in output image
- quality.
-
- In the other direction, -Q values below 50 will produce very small files of
- low image quality. Settings around 5 to 10 might be useful in preparing an
- index of a large image library, for example. Try -Q 2 (or so) for some
- amusing Cubist effects. (Note: -Q values below about 25 generate 2-byte
- quantization tables, which are considered optional in the JPEG standard.
- cjpeg emits a warning message when you give such a -Q value, because some
- commercial JPEG programs may be unable to decode the resulting file.)
-
-
- DJPEG DETAILS
-
- The command line switches for djpeg are:
-
- -G Select GIF output format (implies -q, with default
- of 256 colors).
-
- -P Select PPM or PGM output format (this is the default).
- PGM is emitted if the JPEG file is gray-scale or if -g
- is specified.
-
- -R Select RLE output format. Requires URT library.
-
- -T Select Targa output format. Gray-scale format is
- emitted if the JPEG file is gray-scale or if -g is
- specified; otherwise, colormapped format is emitted
- if -q is specified; otherwise, 24-bit full-color
- format is emitted.
-
- -g Force gray-scale output even if input is color.
-
- -q N Quantize to N colors. This reduces the number of
- colors in the output image so that it can be displayed
- on a colormapped display or stored in a colormapped
- file format. For example, if you have an 8-bit
- display, you'd need to quantize to 256 or fewer colors.
-
- -D Do not use dithering in color quantization.
- By default, Floyd-Steinberg dithering is applied when
- quantizing colors, but on some images dithering may
- result in objectionable "graininess". If that
- happens, you can turn off dithering with -D.
- -D is ignored unless you also say -q or -G.
-
- -1 Use one-pass instead of two-pass color quantization.
- The one-pass method is faster and needs less memory,
- but it produces a lower-quality image.
- -1 is ignored unless you also say -q or -G. Also,
- the one-pass method is always used for gray-scale
- output (the two-pass method is no improvement then).
-
- -b Perform cross-block smoothing. This is quite
- memory-intensive and only seems to improve the image
- at very low quality settings (-Q 10 to 20 or so).
- At normal -Q settings it may make the image worse.
-
- -d Enable debug printout. More -d's give more printout.
- Also, version information is printed at startup.
-
- -m memory Set limit for amount of memory to use in processing
- large images. Value is in thousands of bytes, or
- millions of bytes if "M" is attached to the number.
- For example, -m 4m selects 4000000 bytes. If more
- space is needed, temporary files will be used.
-
-
- HINTS
-
- Avoid running an image through a series of JPEG compression/decompression
- cycles. Image quality loss will accumulate; after ten or so cycles the image
- may be noticeably worse than it was after one cycle. It's best to use a
- lossless format while manipulating an image, then convert to JPEG format when
- you are ready to file the image away.
-
- The -o option to cjpeg is worth using when you are making a "final" version
- for posting or archiving. It's also a win when you are using low -Q settings
- to make very small JPEG files; the percentage improvement is often a lot more
- than it is on larger files.
-
- The default memory usage limit (-m) is set when the software is compiled.
- If you get an "insufficient memory" error, try specifying a smaller -m value,
- even -m 0 to use the absolute minimum space. You may want to recompile with
- a smaller default value if this happens often.
-
- djpeg with two-pass color quantization requires a good deal of space; on
- MS-DOS machines it may run out of memory even with -m 0. In that case you
- can still decompress, with some loss of image quality, by specifying -1
- for one-pass quantization.
-
- If more space is needed than will fit in the available main memory (as
- determined by -m), temporary files will be used. The temporary files are often
- rather large: in typical cases they occupy three bytes per pixel, for example
- 3*800*600 = 1.44Mb for an 800x600 image. If you don't have enough free disk
- space, leave out -o (for cjpeg) or specify -1 (for djpeg).
-